<?php
include "pdo.php";
$str = file_get_contents('http://www.zhulang.com/');
//$ste = $html;
//print_r($ste);die;
$preg='#sec.*sec3.*sec.*sec3#isU';
preg_match($preg,$str,$arr);
//print_r($arr);die;
$preg_content='#<li>.*<a href="(.*)" .*>.*<dl>(.*)<dd>.*<div>.*<h3 title="(.*)">.*</h3>.*<em>(.*)</em>.*</div>.*</dd>(.*)</dl>.*</a>.*</li>#isU';
preg_match_all($preg_content,$arr[0],$arr_content);
//print_r($arr_content);die;
//print_r($arr);die;s
$pdo=new pdo1();
foreach($arr_content[1] as $k=>$v)
{
    $arr1['url']=$arr_content[1][$k];
    $arr1['imgurl']=$arr_content[2][$k];
    $arr1['name']=$arr_content[3][$k];
    $arr1['title']=$arr_content[4][$k];
    $pdo->insert($arr1,'new');

}
//echo $str;
//function curl($url)
//{
//    $ch=curl_init();
//    curl_setopt($ch,CURLOPT_URL,$url);
//    curl_setopt($ch,CURLOPT_HEADER,0);
//    curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
//    curl_setopt($ch,CURLOPT_SSL_VERIFYHOST,false);
//    curl_setopt($ch,CURLOPT_SSL_VERIFYPEER,false);
//    $str=curl_exec($ch);
//    curl_close($ch);
//    return $str;
//
//}